package com.itheima.mapper;

import com.itheima.pojo.Employee;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface EmployeeMapper {

    Employee getEmployee(@Param("username") String username,@Param("password") String password);

    void updateToken(@Param("token") String token,@Param("id") String id);
    @Select("select  * from employee where token =#{token}")
    Employee getByToken(@Param("token") String token);

    @Update("update  employee set  token=null where id=#{id}")
    public void clearToken(String id);

    @Select("select  * from employee where id=#{id}")
    Employee getById(String id);


    List<Employee> page(@Param("name") String name, @Param("start") Integer start,@Param("pageSize") Integer pageSize);
    long countEmployee(@Param("name") String name);

    Integer save(Employee employee);

    Integer update(Employee employee);
}
